#ifndef _FTPCLIENT_HPP
#define _FTPCLIENT_HPP

#include "socketenv.hpp"
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <string>
#include "myio.hpp"

using std::string;

enum TYPE
{
	ASCI,
	BINARY
};

class FtpClient
{
public:
	FtpClient(const string& hostname, const string& user, const string& pwd);
	FtpClient(const string& ip, const string& port, const string &user, const string &pwd);
	void login();
	void logout();
	void setType(TYPE t);
	//void setPASV();
	void getList();
	~FtpClient();

private:
	string _user;
	string _pwd;
	const static int MAXLINE = 1024;
	char linebuf[MAXLINE];
	struct addrinfo *_ctrlServ, *_dataServ;
	SOCKET _ctrlSock;
	SOCKET _dataSock;
private:
	MyIO *_myIO;
	SocketEnv *_env;
	friend unsigned int __stdcall fun(void *);
};

#endif
